<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>自动化立体库</title>
<link rel="stylesheet" href="css/style.css">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
  <script src="js/json.js"></script>
  <style>
    .btn-grp{
      padding-bottom: 20px;
      border-bottom:1px solid #CCC;      
    }
    .btn-grp .btn{
      margin: auto auto 10px 10px;
    }
  </style>
<!-- Stylesheet -->
</head>
<body style="background: #F7F4F8">
  <div class="logo">
    <img src="images/img_logo.png" alt="" width="50">
  </div>
  <div class="link-btn">
    <a class="link-item" href="index.html">
      仓库管理系统
    </a>
    <a class="link-item" href="index.html#s2">
      解决方案
    </a>
    <a class="link-item on" href="index.html#s3">
      周边设备
    </a>
    <a class="link-item" href="index.html#s4">
      案例
    </a>
  </div>
  <div class="nav-bg-inner">
    <img src="images/bg_text_2.png" class="wow fadeInDown">
  </div>
  <div class="section container" id="container">
  </div>
  <div class="footer">
      <div id="copyright" class="container section">
      </div>
    </div>
  <!-- JavaScript -->
  <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script>
  $(function(){
    getPartData()
    document.getElementById("copyright").innerHTML=json.Copyright
  })
  function getPartData() {
    if (getUrlParam("pNum")) {
      var pNum = parseInt(getUrlParam("pNum"))
    }
    if (getUrlParam("sub_pNum")) {
      var sub_pNum = parseInt(getUrlParam("sub_pNum"))
    }
    console.log('sub_pNum', sub_pNum)
    var html_p = '';
    html_p += '<div class="item-nav">';
    for (var i = 0; i < json.part.length; i++) {
      if (i===pNum) {
        html_p += '<p class="selected"  num="'  + i + '">';
      } else {
        html_p += '<p  num="'  + i + '">';
      }
      html_p += '<a href=javascript:;>';
      html_p += json.part[i].classify;
      html_p += '</a>';
      html_p += '</p>';
      /*html_p += '<ul class="subnav">';
      for (var m = 0; m < json.part[i].subnav.length; m++) {
        html_p += '<li subNum="'+m+'">'+json.part[i].subnav[m].title+'</li>';
      }
      html_p += '</ul>'*/
    }
    html_p += '</div>';
    html_p += '<div class="item-container">';
    html_p += '<div class="row btn-grp">';
    for (var m = 0; m < json.part[pNum].subnav.length; m++) {
      // html_p += '<div class="col-xs-2" subNum="'+m+'">'
      if(m===sub_pNum){
        html_p += '<a class="btn btn-info col-xs-3" subNum="'+m+'">'+json.part[pNum].subnav[m].title+'</a>'
      } else {
        html_p += '<a class="btn btn-default col-xs-3" subNum="'+m+'">'+json.part[pNum].subnav[m].title+'</a>'
      }
      // html_p += '</div>';
    }
    html_p += '</div>';
    html_p += '<h3 class="main_font">'+json.part[pNum].subnav[sub_pNum].title+'</h3>';
    if(json.part[pNum].subnav[sub_pNum].content){
      for (var n=0;n<json.part[pNum].subnav[sub_pNum].content.length;n++) {
        html_p += '<p>'+json.part[pNum].subnav[sub_pNum].content[n]+'</p>';
      }
    }
    for (var k=0;k<json.part[pNum].subnav[sub_pNum].img.length;k++) {
      html_p += '<img src="'+'images/part/'+json.part[pNum].subnav[sub_pNum].img[k]+'">';
    }
    html_p += '</div>';
    $('#container').html(html_p)
    // 点击分类标题切换问题列表
    $('.item-nav p').click(function () {
      $(this).addClass('selected').siblings('p').removeClass('selected');
      var pNumTmp = parseInt($(this).attr('num'));
      console.log('pNumTmp', pNumTmp)
      /*var list = '';
      list += '<p>';
      list += json.part[pNum].subnav[0].content;
      list += '</p>';
      for (var k=0;k<json.part[pNumTmp].subnav[0].img.length;k++) {
        html_p += '<img src="'+'images/part/'+json.part[pNum].subnav[0].img[k]+'">';
      }*/
      location.href='part.html?pNum=' + pNumTmp+'&sub_pNum=0';
      // $('#container .item-container').html(list);
    })
    $('.btn-grp .btn').click(function () {
      var sub_pNumTmp = parseInt($(this).attr('subnum'));

      // var sub_list = '';
      // sub_list += '<p>';
      // sub_list += json.part[pNum].subnav[sub_pNumTmp].content;
      // sub_list += '</p>';
      // for (var k=0;k<json.part[pNum].subnav[sub_pNumTmp].img.length;k++) {
      //   html_p += '<img src="'+'images/solution/'+json.part[pNum].subnav[sub_pNumTmp].img[k]+'">';
      // }
      location.href='part.html?pNum=' + pNum+'&sub_pNum='+sub_pNumTmp;
      //$('.btn-grp .btn:eq('+pNum+')').addClass('btn-info').removeClass('btn-default').siblings('.btn').addClass('btn-default').removeClass('btn-info');
      // $('#container .item-container').html(sub_list);
    })
  }
</script>
</body>
</html>